package com.example.model;

import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate;

public class Person {
    private final SimpleIntegerProperty id;
    private final SimpleStringProperty name;
    private final SimpleStringProperty email;
    private final SimpleObjectProperty<LocalDate> birthday;

    public Person(int id, String name, String email, LocalDate birthday) {
        this.id = new SimpleIntegerProperty(id);
        this.name = new SimpleStringProperty(name);
        this.email = new SimpleStringProperty(email);
        this.birthday = new SimpleObjectProperty<>(birthday); // 修改为属性包装
    }

    // Getter 方法
    public int getId() {
        return id.get();
    }

    public String getName() {
        return name.get();
    }

    public String getEmail() {
        return email.get();
    }

    public LocalDate getBirthday() {
        return birthday.get();
    }

    // Property 方法（表格绑定需要）
    public SimpleIntegerProperty idProperty() {
        return id;
    }

    public SimpleStringProperty nameProperty() {
        return name;
    }

    public SimpleStringProperty emailProperty() {
        return email;
    }

    public SimpleObjectProperty<LocalDate> birthdayProperty() {
        return birthday;
    }
}